function register() {
    var info = localStorage['userInfos']
    if ($('#userName').val() == '' || $('#userPassword').val() == '' || $('#userNumber').val() == '' || $('#newuserPassword').val() == '') {
        alert('这都是必填的哟')
    } else {
        var phone = $('#userNumber').val()
        if (!(/^1[3456789]\d{9}$/.test(phone))) {
            alert("手机号码有误，请重填");
            return;
        } else if ($('#userPassword').val() != $('#newuserPassword').val()) {
            alert('两次密码输入不一致')
            return;
        } else {
            if (info == null) {
                var userInfos = []
                userInfos.push({
                    "userName": $('#userName').val(),
                    "userPassword": $('#userPassword').val(),
                    "userNumber": $('#userNumber').val(),
                })
                localStorage['userInfos'] = JSON.stringify(userInfos);
                location.href = 'login.html'
            } else {
                var userInfos = JSON.parse(localStorage['userInfos']);
                userInfos.push({
                    "userName": $('#userName').val(),
                    "userPassword": $('#userPassword').val(),
                    "userNumber": $('#userNumber').val(),
                })
                localStorage['userInfos'] = JSON.stringify(userInfos);
                location.href = 'login.html'
            }
        }
    }
}
$(function() {
    $('#userName').focus();
})